package com.liuwa.common.bean;

import io.swagger.annotations.ApiModelProperty;

/**
 * @ProjectName: das
 * @Package: com.liuwa.openapi.common.request
 * @ClassName: PageQuery
 * @Author: Administrator
 * @Description: 分页查询
 * @Date: 2022/1/20 14:08
 * @Version: 1.0
 */
public abstract class BasePageQuery extends BaseQuery{

    /**
     * 页码
     */
    @ApiModelProperty(value = "页码", example = "1", name = "page")
    protected Integer page;

    /**
     * 分页大小
     */
    @ApiModelProperty(value = "分页大小", example = "20", name = "size")
    protected Integer size;



    public Integer getPage() {
        if(page == null){
            return 1;
        }
        return page;
    }

    public void setPage(Integer page) {
        this.page = page;
    }

    /**
     * 兼容 参数名称 pageNum
     * @param pageNum
     */
    public void setPageNum(Integer pageNum) {
        this.page = pageNum;
    }

    public Integer getSize() {
        if(size == null){
            size = 10;
        }
        if(size > 100){
            return 10;
        }
        return size;
    }


    public void setSize(Integer size) {
        this.size = size;
    }

    /**
     * 兼容 参数名称 pageSize
     * @param pageSize
     */
    public void setPageSize(Integer pageSize){
        this.size = pageSize;
    }

}